package com.atguigu.gmall.product.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author lfy
 * @Description
 * @create 2023-08-15 14:04
 */
@Configuration
public class AppMyBatisPlusConfiguration {

    @Bean
    MybatisPlusInterceptor mybatisPlusInterceptor(){
        //1、插件主体
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();

        //2、准备分页插件
        PaginationInnerInterceptor innerPageInterceptor = new PaginationInnerInterceptor();
        innerPageInterceptor.setOverflow(true);//自动页码溢出处理


        interceptor.addInnerInterceptor(innerPageInterceptor);


        return interceptor;
    }
}
